#ifndef TSMOOTH_H
#define TSMOOTH_H

#include <opencv2/opencv.hpp>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <opencv2/core/eigen.hpp>
#include <vector>


using namespace cv;
using namespace std;

enum ConvolutionType {   
	/* Return the full convolution, including border */
	CONVOLUTION_FULL, 

	/* Return only the part that corresponds to the original image */
	CONVOLUTION_SAME,

	/* Return only the submatrix containing elements that were not influenced by the border */
	CONVOLUTION_VALID
};

// utilities
void dumpMat(const Eigen::MatrixXf &in);
Mat diff(const Mat &x,const int direction);
void conv2(const Mat &img, const Mat& kernel, ConvolutionType type, Mat& dest);
Mat lpfilter(const Mat &fin, const double sigma);
void computeTextureWeights(const Mat &fin, double sigma,double sharpness, vector<Mat> &retWeights);
Eigen::SparseMatrix<float> spdiags(const Eigen::MatrixXf &a_in, const vector<int> lines, const int dimx, const int dimy);

Eigen::MatrixXf padarray(const Eigen::MatrixXf &a_in, const int count, const int type);
Eigen::MatrixXf cvToEigen(const cv::Mat &in);

Mat solveLinearEquation(const Mat &m_IN,const Mat &wx,const Mat &wy, const double lambda);
Mat tsmooth(const Mat &I,double lambda,double sigma,double sharpness, int maxIter);

#endif